extends ../main_temp

block panelHeading
    <form action="/book/list.html" method="post" class="form-inline inline-block">
    <div class="form-group">
    <input type="text" name="name" value="#{searchArgs ? searchArgs.name : ''}" class="form-control input-sm" placeholder="书本">
    </div>
    <div class="form-group">
    <input type="number" name="minPrice" value="#{searchArgs ? searchArgs.minPrice : ''}" class="form-control input-sm" placeholder="最低价">
    </div>
    <div class="form-group">
    <input type="number" name="maxPrice" value="#{searchArgs ? searchArgs.maxPrice : ''}" class="form-control input-sm" placeholder="最高价">
    </div>
    <button type="button" id="btn_search" class="btn btn-default btn-sm">
    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
    </button>
    </form>
    <div class="inline-block" style="float: right;">
    <button type="button" id="btn_add" class="btn btn-success">添加</button>
    <button type="button" id="btn_del_batch" class="btn btn-success">批量删除</button>
    //<a href="/book/toInsertSql" class="btn btn-success">导出Sql</a>
    </div>

include ../datatable

block panelBody
    - let titles = ["<input name='cb_select_all' type='checkbox'>", "序号", "书名", "日期", "单价", "数量", "操作"];
    +datatable(titles)
        each item in books ? books : []
            tr
                td(class="text-center")!= `<input value="${item.id}" type='checkbox' name='cb_select'>`
                td(class="text-center")!= item.id
                td(class="text-center")!= item.name
                td(class="text-center")!= moment(item.createDate).format("yyyy-MM-DD")
                td(class="text-center")!= item.price
                td(class="text-center")!= item.count
                td(class="text-center")!= `<a href="/book/edit.html?id=${item.id}" class="btn btn-success btn-sm">编辑</a><button data-href=/book/del.do?id=${item.id} class="btn btn-del btn-danger btn-sm">删除</button>`
    +pagination(pager)

block append scripts
    script(src="/js/common.js")
    script(src="/js/book/list.js")